package com.ant.storage.service.impl;

import com.ant.storage.common.ResultPage;
import com.ant.storage.dto.GoodsDto;
import com.ant.storage.pojo.GoodsList;
import com.ant.storage.mapper.GoodsListMapper;
import com.ant.storage.service.IGoodsListService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author melon
 * @since 2022-03-16
 */
@Service
public class GoodsListServiceImpl extends ServiceImpl<GoodsListMapper, GoodsList> implements IGoodsListService {

    @Override
    public ResultPage PageGoodslist(GoodsDto goodsDto) {
        PageHelper.startPage(goodsDto.getPageIndex(),goodsDto.getPageSize());
        QueryWrapper<GoodsList> wrapper=new QueryWrapper<>();
        wrapper.lambda().eq(GoodsList::getParentId,goodsDto.getParentId());
        wrapper.orderByDesc("id");
//
//        IPage<GoodsList> page=this.page(
//                new Query<GoodsList>().getPage(params),
//                params.size()==0?null:queryWrapper);//查询条件
        PageInfo<GoodsList> info=new PageInfo<>(this.baseMapper.selectList(wrapper));
        return new ResultPage(info);
    }

}
